<template>
	<div id="animation" class="posi">
		<nav is="bNav"></nav>
		<sNav :tid="parent_tid" @chageTid="chageTid" ></sNav>
		<!--<div class="conTent-wrap">
			123
			<p @click="add">{{getCount}}</p>
		</div>-->
		<!--<keep-alive>-->
			<aContents :tid="parent_tid" @chageTid="chageTid"></aContents>
		<!--</keep-alive>-->
		<footer is="bFooter"></footer>
	</div>
</template>

<script>
	import sNav from 'components/navContents/sNav'
	import aContents from 'components/navContents/contents'
	import bNav from 'components/nav'
	import bFooter from 'components/footer'
	export default{
		mounted(){
			
		},
		data(){
			return{
				parent_tid:this.$route.params.tid,
				conData:[],
				
			}
		},
		components:{
			bNav,sNav,aContents,bFooter
		},
		methods:{
			
//			scrollFunc(){
//				let scrollAction = {x: 'undefined', y: 'undefined'};
//			    if (typeof scrollAction.x == 'undefined') {
//			        scrollAction.x = window.pageXOffset;
//			        scrollAction.y = window.pageYOffset;
//			    }
//			    var diffX = scrollAction.x - window.pageXOffset;
//			    var diffY = scrollAction.y - window.pageYOffset;
//			    if (diffX < 0) {
//			        // Scroll right
//			        scrollDirection = 'right';
//			    } else if (diffX > 0) {
//			        // Scroll left
//			        scrollDirection = 'left';
//			    } else if (diffY < 0) {
//			        // Scroll down
//			        scrollDirection = 'down';
//			    } else if (diffY > 0) {
//			        // Scroll up
//			        scrollDirection = 'up';
//			    } else {
//			        // First scroll event
//			    }
//			    scrollAction.x = window.pageXOffset;
//			    scrollAction.y = window.pageYOffset;
//			},
			chageTid(tid){
				this.parent_tid = tid
			},
			add(){
				//触发store里面的mutations定义的方法
				this.$store.commit('increment')
			},
		},
		computed:{
//			count(){
//				return this.$store.state.count
//			}
			getCount(){
				return this.$store.getters.getCount
			}
		},
		watch:{
			$route(newValue,oldValue){
				if(newValue.path.indexOf("animation")){
					this.$store.commit('setTid',{
						curTid:newValue.params.tid
					})
					this.parent_tid = newValue.params.tid
				}
			}
		}
	}
</script>

<style lang="scss">
	.posi{
		position: relative;
	}
	.conTent-wrap{
		height: 1000px;
		width: 100%;
		padding-top: 20%;
		border-top: 1px solid black;
	}
	.op{
		transform: translateY(-100%);
	}
</style>